package com.chuangjiangx.member.basic.ddd.domain.model.msg;

import com.chuangjiangx.commons.wx.msg.model.AbstractBaseData;
import com.chuangjiangx.commons.wx.msg.model.Keyword4Data;
import com.chuangjiangx.commons.wx.msg.model.MsgDataMeta;
import lombok.Data;

import java.math.BigDecimal;

/**
 * @author cj-ch
 * @date 2018/1/31 上午11:19
 * 储值卡退款通知
 * 详细内容
{{first.DATA}}
退款金额：{{keyword1.DATA}}
订单编号：{{keyword2.DATA}}
退款方式：{{keyword3.DATA}}
储值余额：{{keyword4.DATA}}
{{remark.DATA}}
内容示例
您的退款已成功。
退款金额：350元
订单编号：201705241495593275571
退款方式：储值余额（原返）
储值余额：562元
感谢您的使用，祝您生活愉快。
 */
@Data
public class MbrCardRefundMsg extends AbstractMbrWXMsg {
    /**
     * 标题
     *
     */
    private String title = "您有一笔退款成功通知,详情如下:";

    /**
     * 退款金额
     */
    private BigDecimal refundAmount;
    /**
     * 订单编号
     */
    private String orderNumber;
    /**
     * 退款方式
     */
    private String refundMethod = "会员储值卡";
    /**
     * 账户余额
     */
    private BigDecimal accountBalance;
    /**
     * 备注
     */
    private String remark = "退款金额已退回你储值卡账户,请注意查收.";

    public MbrCardRefundMsg(BigDecimal refundAmount, String orderNumber, BigDecimal accountBalance) {
        this.refundAmount = refundAmount;
        this.orderNumber = orderNumber;
        this.accountBalance = accountBalance;
    }

    @Override
    public AbstractBaseData toMsgData(){

        Keyword4Data data = new Keyword4Data();
        data.setFirst(new MsgDataMeta(title));

        data.setKeyword1(new MsgDataMeta(refundAmount + "元"));
        data.setKeyword2(new MsgDataMeta(orderNumber));
        data.setKeyword3(new MsgDataMeta(refundMethod));
        data.setKeyword4(new MsgDataMeta(accountBalance + "元"));

        data.setRemark(new MsgDataMeta(remark));
        return data;
    }

    @Override
    public WXMsg getWXMsg() {
        return WXMsg.MBR_CARD_REFUND;
    }
}
